//
// Project: Disagreement in science: Missing women




clear all
version 15.1  



//
// set locals, seed, etc
local demographic_controls "i.residence i.race_white i.edub i.ageb i.experience"
local task_controls "intro1playerbelief_self intro1playerbelief_others i.intro1playercorrect_table_extra i.indifferent"
local money_controls "i.belief_treatment_center"
local treatment "plain"


use "${data}/output/contest_experiment.dta", clear



//
// generate variables for analysis
 


//
// analysis

// gender gap contest treatment, no controls
local i=1
local coefficients`i' "2"
regress intro1playerlook i.female if enforce==1 & intro1playertreatment=="`treatment'", vce(robust)
matrix m`i' = r(table)
scalar n`i' = e(N)
scalar rsq`i' = e(r2)
* p-vales
foreach k of numlist `coefficients`i'' {
	local p`i'_`k' = m`i'[4,`k']
}

// gender gap contest treatment, controls
local i=2
local coefficients`i' "2 3 4 6 8"
regress intro1playerlook i.female `task_controls' `demographic_controls' if enforce==1 & intro1playertreatment=="`treatment'", vce(robust)
matrix m`i' = r(table)
scalar n`i' = e(N)
scalar rsq`i' = e(r2)
* p-vales
foreach k of numlist `coefficients`i'' {
	local p`i'_`k' = m`i'[4,`k']
}

// gender gap deduct a $1 treatment, no controls
local i=3
local coefficients`i' "2"
regress intro1playerlook i.female if enforce==0 & intro1playertreatment=="`treatment'", vce(robust)
matrix m`i' = r(table)
scalar n`i' = e(N)
scalar rsq`i' = e(r2)
* p-vales
foreach k of numlist `coefficients`i'' {
	local p`i'_`k' = m`i'[4,`k']
}

// gender gap deduct a $1 treatment, controls
local i=4
local coefficients`i' "2 4"
regress intro1playerlook i.female `money_controls' `demographic_controls' if enforce==0 & intro1playertreatment=="`treatment'", vce(robust)
matrix m`i' = r(table)
scalar n`i' = e(N)
scalar rsq`i' = e(r2)
* p-vales
foreach k of numlist `coefficients`i'' {
	local p`i'_`k' = m`i'[4,`k']
}

// difference in gender gap across treatment, no controls
local i=5
local coefficients`i' "2 4 8"
regress intro1playerlook i.female##i.enforce if intro1playertreatment=="`treatment'", vce(robust)
matrix m`i' = r(table)
scalar n`i' = e(N)
scalar rsq`i' = e(r2)
* p-vales
foreach k of numlist `coefficients`i'' {
	local p`i'_`k' = m`i'[4,`k']
}

// difference in gender gap across treatment, no controls
local i=6
local coefficients`i' "2 4 8"
regress intro1playerlook i.female##i.enforce `demographic_controls' if intro1playertreatment=="`treatment'", vce(robust)
matrix m`i' = r(table)
scalar n`i' = e(N)
scalar rsq`i' = e(r2)
* p-vales
foreach k of numlist `coefficients`i'' {
	local p`i'_`k' = m`i'[4,`k']
}

// significance stars for regressions
forvalues j=1/6 {
	foreach k of numlist `coefficients`j'' {
		if `p`j'_`k''<0.1 & `p`j'_`k''>=0.05 {
			scalar st`j'_`k'="*"
		}
		else if `p`j'_`k''<0.05 & `p`j'_`k''>=0.01 {
			scalar st`j'_`k'="**"
		}
		else if `p`j'_`k''<0.01 & `p`j'_`k''>=0.001 {
			scalar st`j'_`k'="***"
		}
		else if `p`j'_`k''<0.001 {
			scalar st`j'_`k'="****"
		}
		else {
			scalar st`j'_`k'=""
		}
	}
}



